# coding:utf-8
import requests

from src.utils import SingletomRedisPool
from src import settings


def get_request(url, headers={}, cookies={}, method="GET"):
    try:
        return requests.request(url=url, headers=headers, cookies=cookies, method=method)
    except:
        conn = SingletomRedisPool.RedisPool.getConn()
        conn.lpush(settings.REDIS_QUEUE_URLS, url)
        return False


def request(url):
    # writed by user
    return get_request(url)
